'use strict';

var robruleModel = require('../../config/models').robruleModel,
  rules = require('../../config/rules'),
  co = require('co');

var robrule = [{
  name: 'hello',
  description: '互相的问候',
  pattern: /(hello|hi|嗨|你好)[啊\.\!\。\！]*(##ouxjVwDPkjJYz6HyJt2mI6_Xk1K4)$/i,
  handler: co.wrap(function *(info){
    yield 'rules.doGen()';
  }),
  openId: 'ouxjVwDPkjJYz6HyJt2mI6_Xk1K4',
  remark: 'user rule',
  state: 1,
  mode: 0
}, {
  name: 'hello',
  description: '互相的问候',
  pattern: /(hello|hi|嗨|你好)[啊\.\!\。\！]*/i,
  handler: co.wrap(function *(info){
    yield "大家好才是真的好";
  }),
  remark: 'user rule',
  state: 1,
  mode: 1
}];

robruleModel.create(robrule, function(err, doc) {
  if (err) {
    console.log(err);
  } else {
    console.log(doc);
  }
});
